package com.chen.boot.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chen.boot.db.entity.ChatMessage;
import com.chen.boot.db.entity.ContactsInfo;
import com.chen.boot.db.mapper.ChatMessageMapper;
import com.chen.im.view.ContactsList;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.List;

import javax.annotation.Resource;

/**
 * @Description
 * @Author Pengwei
 * @CreatDate 2021/11/14 20:59
 */
@RestController
public class TestController {

    @Resource
    ChatMessageMapper chatMessageMapper;

    @RequestMapping("1")
    public Object insert(String name) {
        ContactsInfo contactsInfo = new ContactsInfo();
        contactsInfo.setIp("192.168.100.2");
        contactsInfo.setId(1460636836453793794L);
        contactsInfo.setName(name);
        contactsInfo.setLastCheckTime(LocalDateTime.now());
        ContactsList.updateItems(contactsInfo);
        return "";
    }

    @RequestMapping("2")
    public Object select() {
        List<ChatMessage> chatMessages = chatMessageMapper.selectList(new QueryWrapper<>());
        return chatMessages;
    }



}
